

let debounce = (fn,time)=>{
  let timer = null
  return function () {
    debugger
    if(timer) return
    let arg = arguments
    timer = setTimeout(() => {
      fn.apply(this,arg)
      timer = null
    }, time);
  }
}

let throttle = (fn,wait)=>{
  let lastTime = 0
  return function () {
    let now = new Date().getTime()
    let arg = arguments
    if(now - lastTime >= wait){
      fn.call(this,arg)
      lastTime = now
    }
  }
}


